<?php
//1.引入数据库配置信息
require_once __DIR__.'/config.php';
//2.获取要查询的用户名（通过地址栏传递参数）
$username = isset($_GET['username']) ? $_GET['username'] : '';

if(empty($username)){
    echo '用户名不能为空';
}

echo $username;
//3.连接数据库
$conn = @mysql_connect($db_host,$db_user,$db_psw) or die('数据库连接失败.');
mysql_select_db($db_name,$conn);
mysql_query('SET NAMES'.$db_charset);
$sql = "select * from iotek_user where username='{$username}'";
echo $sql;

$res = mysql_query($sql,$$conn);
$userinfo = mysql_fetch_assoc($res);
var_dump(($username));

mysql_close($conn);

if($username){
 echo 'user:'.$username;
}else{
    echo '不存在用户名为'.$username.'的用户';
}